import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 苏李涛
 * Date: 2024-05-07
 * Time: 16:48
 */
public class Main {
    public static void main(String[] args) {
        /*int[] array1 = new int[]{1,2,3,4};
        int[] array2 = new int[]{1,2,3,4};
        boolean judge = Arrays.equals(array1, array2);
        System.out.println(judge);*/

        //填充
        int[] array = new int[10];
        Arrays.fill(array, 1, 8, -2);
        System.out.println(Arrays.toString(array));
    }












    public static void main5(String[] args) {
        int[] array = new int[]{1,2,3,6};
        //提供部分拷贝数组的方法
//        int[] copy = Arrays.copyOf(array,array.length*3);
//        int[] copy = Arrays.copyOfRange(array, 1, 2);

//        int[] copy = copyArray(array);


        int[] copy = new int[array.length];
        System.arraycopy(array, 0, copy, 0, array.length);
        System.out.println(Arrays.toString(copy));
    }

    //拷贝数组
    public static int[] copyArray(int[] array) {
        int[] copy = new int[array.length];
        for (int i = 0; i < copy.length; i++) {
            copy[i] = array[i];
        }
        return copy;
    }
}
